ragawu
06-15-2004, 08:41 AM
Hi I'm tryign to use javascript to copy a value into a text field when the user clicks on an image.
The whole script is generated by php and I may be having single-quote or double-quote issues though feel free to correct me on this.
function: (in head of page)
<script language="JavaScript">
<!--
var isReady = false;
function changeText(helpID, helpText)
{
if (isReady){
document.getElementByName(helpID).value = helpText;
document.getElementByName(helpID).focus();
document.getElementByName(helpID).select();
}
else{
alert("This page is not fully loaded yet...\nPlease wait for the page to finish loading.");
}
}
//-->
</script>
in body tag
<body onload="isready=true">
this is the line that calls the function:
<font size='1' color='#666666'><img src='http://www.ginezbukov.com/phpsurveyor/help.gif' alt='Help' align='left' onMouseDown='changeText('1X1X5', 'Cleeland')'>Cleeland</font>
I'm receiving an error internet explorer on the line that calls the function. Error is "syntax error".
I realise this has probably ben asked before, but I've tried searching and can't find anything relevant.
hope you can help,.
alasdair
The whole script is generated by php and I may be having single-quote or double-quote issues though feel free to correct me on this.
function: (in head of page)
<script language="JavaScript">
<!--
var isReady = false;
function changeText(helpID, helpText)
{
if (isReady){
document.getElementByName(helpID).value = helpText;
document.getElementByName(helpID).focus();
document.getElementByName(helpID).select();
}
else{
alert("This page is not fully loaded yet...\nPlease wait for the page to finish loading.");
}
}
//-->
</script>
in body tag
<body onload="isready=true">
this is the line that calls the function:
<font size='1' color='#666666'><img src='http://www.ginezbukov.com/phpsurveyor/help.gif' alt='Help' align='left' onMouseDown='changeText('1X1X5', 'Cleeland')'>Cleeland</font>
I'm receiving an error internet explorer on the line that calls the function. Error is "syntax error".
I realise this has probably ben asked before, but I've tried searching and can't find anything relevant.
hope you can help,.
alasdair