Click to See Complete Forum and Search --> : Need assistance


sweetvicki
08-26-2008, 11:39 AM
Hi All...

Please bare with me, for I am just learning php and I am having a problem right now..I added the following codes to my php page and I am getting syntax errors. Can someone assist me?

<script>Application.addTitle('', 'open_window1')</script>
<div class="listing" style="display:none" id="open_window1_codediv">
<xmp id="open_window1" class="listing" >
var win = new Window({className: "dialog", width:350, height:400, zIndex: 100, resizable: true, title: "Assistant Help", showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff, draggable:true, wiredDrag: true})
win.getContent().innerHTML= "<div style='padding:10px'> This is the first line.<br> \
This is the second line of text. <br>\
This is the third line of text.</div>"
win.setStatusBar("Copyright&copy;2008");
win.showCenter();
</xmp>
<script>Application.addEditButton('open_window1')</script>
</div>

It is this line that is giving me the problems:

var win = new Window({className: "dialog", width:350, height:400, zIndex: 100, resizable: true, title: "Assistant Help", showEffect:Effect.BlindDown, hideEffect: Effect.SwitchOff, draggable:true, wiredDrag: true})

What am I missing???

Thanks

SweetVicki
:confused:

NogDog
08-26-2008, 11:09 PM
Are you getting PHP syntax errors or JavaScript syntax errors? (I do not see any PHP code in the sample provided, but before assuming this is a JavaScript question I want to make sure before moving it to the Client Side forum.)

sweetvicki
08-26-2008, 11:17 PM
Yes it is an javascript error

error accurs while interprating your javascript code
SyntaxError: invalid XML attribute value

I am using a main javascript file on the server here is the code to that file:

var Application = {
lastId: 0,
currentSampleNb: 0,

getNewId: function() {
Application.lastId++;
return "window_id_" + Application.lastId;
},

showCode: function(a, id) {
a.innerHTML = $(id + "_codediv").visible() ? "View source" : "Hide source"
$(id + "_codediv").toggle();
},

editCode: function(id) {
var pre = $(id);
// First time
if (!pre.textarea) {
var textarea = document.createElement("textarea");
var dim = pre.getDimensions();
textarea.setAttribute('id', id + "_edit");
textarea.setAttribute('class', 'listing');

pre.textarea = textarea

pre.parentNode.insertBefore(textarea, pre);
}
// Show text area
if (pre.visible()) {
var dim = pre.getDimensions();

pre.textarea.value = pre.innerHTML;
pre.hide();
pre.textarea.style.height = dim.height + "px"
pre.textarea.style.width = "100%"
pre.textarea.style.display = "block";

pre.textarea.focus();
$(id+'_edit_button').innerHTML = "Stop editing";
}
// Remove text area
else {
pre.update(pre.textarea.value);
pre.textarea.style.display = "none";
pre.show();
$(id+'_edit_button').innerHTML = "Edit Source";
}
},

evalCode: function(id) {
var pre = $(id);
var code;
if (pre.textarea && pre.textarea.visible)
code = pre.textarea.value;
else
code = pre.innerHTML;

code = code.gsub("&lt;", "<");
code = code.gsub("&gt;", ">");

try {
eval(code);
}
catch (error) {
Dialog.alert(" error accurs while interprating your javascript code <br/>" + error, {windowParameters: {width:300, showEffect:Element.show}, okLabel: "close"});
}
},

addTitle: function(title, id) {
Application.currentSampleNb++;
idButton = id + '_click_button';

document.write("<h2>" + Application.currentSampleNb + ". " + title + " (<span class='title' id='" + idButton + "' href='#' onmouseover=\"$('" + idButton + "').addClassName('selected')\" onmouseout=\"$('" + idButton + "').removeClassName('selected')\" onclick=\"Application.evalCode('" + id + "', true)\">click here</span>)</h2>")
},

addShowButton: function(id) {
idButton = id + '_show_button';
document.write("<span class='title2' id='" + idButton + "' onmouseover=\"$('" + idButton + "').addClassName('selected')\" onmouseout=\"$('" + idButton + "').removeClassName('selected')\" onclick=\"Application.showCode(this, '" + id + "')\">View source</span>")
},

addEditButton: function(id) {
idButton = id + '_edit_button';
html = "<p class='buttons'><span class='button' onmouseover=\"$('" + idButton + "').addClassName('selected')\" onmouseout=\"$('" + idButton + "').removeClassName('selected')\" id='" + idButton + "' onclick=\"Application.editCode('" + id + "')\">Edit Source</span> </p>";
document.write(html)
},

addViewThemeButton: function(theme, modal) {
idButton = theme + '_theme_button';
html = "<span class='title2' onmouseover=\"$('" + idButton + "').addClassName('selected')\" onmouseout=\"$('" + idButton + "').removeClassName('selected')\" id='" + idButton + "' onclick=\"Application.openThemeWindow('" + theme + "')\">View a window</span>";
document.write(html)
},

addViewThemeDialogButton: function(theme, modal) {
idButton = theme + '_modal_theme_button';
html = "<span class='title2' onmouseover=\"$('" + idButton + "').addClassName('selected')\" onmouseout=\"$('" + idButton + "').removeClassName('selected')\" id='" + idButton + "' onclick=\"Application.openThemeDialog('" + theme + "')\">Open a alert dialog</span>";
document.write(html)
},

openThemeWindow: function(theme, modal) {
var win = new Window(Application.getNewId(), {className: theme, width:300, height:200, title: "Theme : " + theme});
win.getContent().innerHTML= "Lorem ipsum dolor sit amet, consectetur adipiscing elit, set eiusmod tempor incidunt et labore et dolore magna aliquam. Ut enim ad minim veniam, quis nostrud exerc.";
win.showCenter(modal);
},

openThemeDialog: function(theme, modal) {
Dialog.alert("Lorem ipsum dolor sit amet, consectetur adipiscing elit, set eiusmod tempor incidunt et labore et dolore magna aliquam. Ut enim ad minim veniam, quis nostrud exerc",
{windowParameters: {className: theme, width:350}, okLabel: "close"});
},

insertDocOverview: function() {
var div = $('Overview');
var html = "<table class='overview''><tr>";

// Window
html += "<td>Window Class <ul>";
$$(".window").each(function(element){html += "- <a href='#" + element.title + "'>" + element.title + "</a><br/>"});
html += "</ul></td>";

// Dialog
html += "<td>Dialog Module <ul>";
$$(".dialogmodule").each(function(element){html += "- <a href='#" + element.title + "'>" + element.title + "</a><br/>"});
html += "</ul></td>";

// Windows
html += "<td>Windows Module <ul>";
$$(".windows").each(function(element){html += "- <a href='#" + element.title + "'>" + element.title + "</a><br/>"});
html += "</ul></td>";

// Windows
html += "<td>Windows Add-ons <ul>";
$$(".addons").each(function(element){html += "- <a href='#" + element.title + "'>" + element.title + "</a><br/>"});
html += "</ul></td>";

html += "</tr></table>"
div.innerHTML = html;
},

insertNavigation: function(selected) {
document.write('\
<h1><a href="http://prototype-window.xilinus.com"><img border=0 src="pwc.gif"/></a></h1>\
<div class="navigation">\
<ul>\
<li><a id="menu_documentation" href="documentation.html">Documentation</a></li>\
<li><a id="menu_samples" href="samples.html">Samples</a></li>\
<li><a id="menu_debug" href="debug.html">Debug</a></li>\
<li><a id="menu_themes" href="themes.html">Themes</a></li>\
</ul>\
</div>');
$('menu_' + selected).addClassName("selected");
},
addRightColumn: function() {
document.write('\
<style>\
div#wrapper{\
float:left;\
width:100%\
}\
div#content{\
margin-right:0px;\
padding-right:10px;\
border-right: none;\
}\
div#navigation{\
float:left;\
width:00px;\
margin-left:0px;\
text-align:left;\
background:#fef1e2;\
}\
</style>\
')
}
}

I hope I can do this here?

Thank you.

SweetVicki

sweetvicki
08-26-2008, 11:35 PM
I think I could have posted to much code on my last replay for it has to be approved by the modirator..I wanted to show you the external js file I was using on my server.

But in answer to your question yes. This is what I get:

error accurs while interprating your javascript code
[object Error]

That appears in Internet explorer

using firefox I get this error:

error accurs while interprating your javascript code
SyntaxError: invalid XML attribute value.


thanks for your response.

SweetVicki