Page 1 of 1

help with onclick window open

Posted: Wed Nov 19, 2003 1:46 pm
by lloydie-t
Inned a little help with an onclick function. I'm alright on PHP, but no idea about JS. The onclick function changes the colour of a table row, But I also need it to open a new page with the following function.

Code: Select all

<script>
window.open(image,'popup','width='+width+',height='+height+',scrollbars=yes,status=yes');
</script>
I would usually use to open a window.

Code: Select all

<a href="<?php echo "javascript: void window.open('custuseradd.php?cust_id=$cust_id','','width=450, height=500, resizable=yes, scrollbar=yes')";?>">
but how would I do it with this.

Code: Select all

print "<tr class='jnormal' id='jnormal'
onmouseover='tr_mouseover(this)' 
onmouseout='tr_mouseoutnormal(this)' 
onclick='tr_clicknormal(this)'>";
	print "<td class='jobstable' width="40">$row[user_id]</td>";
    print "<td class='jobstable'>$row[forename] $row[surname]</td>";
    print "<td class='jobstable' width="100">$row[job_title]</td>";
    print "<td class='jobstable' width="40">$row[defaultuser]</td>";
    print "<td class='jobstable' width="75">$row[name]</td>";
    print "</tr>";

Posted: Wed Nov 19, 2003 2:12 pm
by microthick
Try:

Code: Select all

print "<tr class="jnormal" id="jnormal"
onmouseover="tr_mouseover(this)"
onmouseout="tr_mouseoutnormal(this)"
onclick="tr_clicknormal(this); window.open('custuseradd.php?cust_id=$cust_id','','width=450, height=500, resizable=yes, scrollbar=yes');">";
print "<td class='jobstable' width="40">$row&#1111;user_id]</td>";
print "<td class='jobstable'>$row&#1111;forename] $row&#1111;surname]</td>";
print "<td class='jobstable' width="100">$row&#1111;job_title]</td>";
print "<td class='jobstable' width="40">$row&#1111;defaultuser]</td>";
print "<td class='jobstable' width="75">$row&#1111;name]</td>";
print "</tr>";
I hope I escaped everything properly.

Posted: Wed Nov 19, 2003 2:43 pm
by lloydie-t
microthick, thanx for that. It done the trick. I tried a similar thing which singe quotes and it did not work.