Discussion » Bloody Javascript

This is a read-only copy. The forum ran on iamcal.com from 2000 until its database was lost in 2016, and this topic was rebuilt from copies saved by the Internet Archive's Wayback Machine. Some replies may be missing.
Posted by Grim..., 14:48, 18th March 2003:
 
=[
Why doesn't this pop up:

<script type="text/javascript">
var name = confirm("You have new private messages in your inbox.
Click OK to go to your inbox, or cancel to continue.")
if (name == true)
{
window.location="inbox.php"
}
</script>
Posted by cal, 15:03, 18th March 2003:
 
what do you mean popup? you've got no popup code there?
Posted by chandler, 15:04, 18th March 2003:
 
could i care less?




(no)
Posted by beargod, 15:05, 18th March 2003:
 
Is it supposed to be a message box?
Posted by beargod, 15:06, 18th March 2003:
 
Chay doesn't apreciate any programming
Posted by chandler, 15:07, 18th March 2003:
 
nope
Posted by cal, 15:07, 18th March 2003:
 
the code, assuming you remove the carriage return mid-string, will do this:

prompt with an yes/no dialog
if the yes button is clicked, the current window navigates to index.php
Posted by cal, 15:09, 18th March 2003:
 
here's the same code, cleaned up a bit

<script type="text/javascript" language="Javascript">
<!--

if (confirm("You have new private messages in your inbox. Click OK to go to your inbox, or cancel to continue.")) {
window.location="inbox.php";
}

//-->
</script>
Posted by Grim..., 16:07, 18th March 2003:
 
Yeah, it was the carrige return that stopped it from working, mind you, Cal's way is much prettier...

Now I've got a PHP problem =]
I analyse a table like this ($link is the link to my MySQL database):

$query = 'ANALYZE TABLE `tblpm` ';
mysql_query( $query, $link ) or die ( "Error! : ".mysql_error() );

How do I display the information passed back from the database?
I've looked all over the web and there is no (simple) information ANYWHERE!
Posted by beargod, 16:09, 18th March 2003:
 
display on a web page?
Posted by beargod, 16:12, 18th March 2003:
 
have you tried the help guids here? www.tripod.lycos.co.uk/build/php4u/ You will have to have a lycos account/maybe a tripod account though
Posted by beargod, 16:12, 18th March 2003:
 
Othere then that I'm not sure cos I am still learning php and mysql myself
Posted by cal, 17:55, 18th March 2003:
 
to view the results of a non standard query:

--------------------------------------------------

<?
$result = mysql_query($sql, $db);

$i = 0;
$fields = array();
while ($i < mysql_num_fields($result)){
$meta = mysql_fetch_field($result);
$i++;
$fields[] = $meta;
}
?>

<table border="1">
<tr>
<?
foreach($fields as $field){
$data = $field->name;
echo "<td><b>$data</b></td>\n";
}
?>
</tr>
<?
while($row = mysql_fetch_array($result)){
echo "<tr>\n";
foreach($fields as $field){
$data = $row[$field->name];
echo "<td>$data</td>\n";
}
echo "</tr>\n";
}
?>
</table>

--------------------------------------------------

of course, the real answer is that ANALYSE doesn't actually return any results. what did you think it did?
Posted by Grim..., 08:58, 19th March 2003:
 
You know, like it did on PHPMyAdmin.

Fanks! =]
Posted by Grim..., 14:25, 28th March 2003:
 
More!

I've got this script which jumps you to a page when a key is pressed.
Is there any way to stop it from paying attention when you have clicked in a text box / area?


<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var key = new Array(); // Define key launcher pages here
key['h'] = "home.html";
key['c'] = "contents.html";
key['p'] = "pictures.html";

function getKey(keyStroke)
{
isNetscape=(document.layers);
eventChooser = (isNetscape) ? keyStroke.which : event.keyCode;
which = String.fromCharCode(eventChooser).toLowerCase();
for (var i in key) if (which == i) window.location = key[i];
}
document.onkeypress = getKey;
// End -->
</script>
Posted by Grim..., 14:34, 28th March 2003:
 
Or - how do I use 'ALT+f' instead of 'f'?
Posted by cal, 14:50, 28th March 2003:
 

<input type="text" onfocus="document.onkeypress=function(){};">
Posted by Grim..., 15:21, 28th March 2003:
 
Fanks Cal!
Posted by Sul, 15:42, 28th March 2003:
 
What the fuck does "Fanks" mean? Am I so out of the loop with whats going down on the streets that its suddenly become acceptable to spell like a fucking 5 year old?
Posted by Victor Menendez, 15:46, 28th March 2003:
 
pah, your just not ' down wit da kids'
Posted by Sul, 15:48, 28th March 2003:
 
I'm not down wit anyone but if I was it most certainly would not be the kids!
Posted by Sul, 15:49, 28th March 2003:
 
Well... maybe the Olsen twins but that's it!
Posted by Victor Menendez, 15:49, 28th March 2003:
 
No me neither after todays shenanegans.
Posted by Grim..., 17:27, 28th March 2003:
 
Sul - if you can't get your own teeny brain to figure out what Fanks means, especially when you look at the context in which it can be used, then you really should just stick to your colouring in...
Posted by chandler, 17:46, 28th March 2003:
 
I do the colouring in. and only muppets say "Fanks" :)
Posted by chandler, 17:47, 28th March 2003:
 
"Thankq" on the other hand is suave and sophisticated
Posted by cal, 17:59, 28th March 2003:
 
grim: less of the nasty attitude thanks
Posted by Victor Menendez, 22:19, 28th March 2003:
 
Yeah - you {edited} {edited}, what the {edited} is your {edited} {edited}
Posted by jeffld, 02:10, 29th March 2003:
 
or some bloody vbscript




Const ssfDRIVES = &H11 ' namespace constant (drives folder = 17)...
Const cdromDrvLtr = "G:\" ' specify your cd-rom drive letter...

Set oSH = CreateObject("Shell.Application")
' open the cd-rom drawer...
oSH.NameSpace(ssfDRIVES).ParseName(cdromDrvLtr).InvokeVerb "E&ject"



Change the drive letter to your CD-ROM drive letter and then save it to a text file called foo.vbs and click it.

enjoy.
Posted by hotchin_2k, 02:37, 29th March 2003:
 
that's cool, how can you use it
??
Posted by jeffld, 20:45, 29th March 2003:
 
That vbscript? It is just for grins. It will open the CD-ROM drawer. Just copy and paste those lines of code into notepad, then save it with a .vbs extension. Then you click on the icon for that .vbs file and voila! the cd drawer opens up.
Posted by Victor Menendez, 20:49, 29th March 2003:
 
how do we know its not a (Secret) code for you to access my hard-drive and steal all my pornography?
Posted by chandler, 22:25, 29th March 2003:
 
cos no-one else wants thousands of three legged elderly donkey snuff pornography jpgs
Posted by Victor Menendez, 02:18, 30th March 2003:
 
Wow, i forgot about you super-editing powers.

Turd
Posted by Gary, 13:50, 30th March 2003:
 
Well... maybe the Olsen twins but that's it!


Amen to that Sul, Amen to that! :)
Posted by hotchin_2k, 15:59, 30th March 2003:
 
i did that, saved it as a .vbs file a ran it, it worked as i expected it would. but is that all i can do with it?
Posted by Victor Menendez, 16:18, 30th March 2003:
 
Would you like him to write you a program that will make you a brew?
Posted by Grim..., 08:54, 31st March 2003:
 
grim: less of the nasty attitude thanks

::whine:: But he started it!
Posted by Sul, 13:35, 31st March 2003:
 
I did too AHAHAHAHAHA, in your face :)
Posted by Grim..., 15:21, 31st March 2003:
 
='[