help with onclick window open

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
lloydie-t
Forum Commoner
Posts: 88
Joined: Thu Jun 27, 2002 3:41 am
Location: UK

help with onclick window open

Post 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>";
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post 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.
lloydie-t
Forum Commoner
Posts: 88
Joined: Thu Jun 27, 2002 3:41 am
Location: UK

Post by lloydie-t »

microthick, thanx for that. It done the trick. I tried a similar thing which singe quotes and it did not work.
Post Reply