...

View Full Version : Small bookmarklets that make testing easier.



glenmac
02-15-2004, 05:03 PM
These are a couple little bookmarklets that make testing your pages easier.
This is for adjusting resolution.

<script>
javascript:external.AddFavorite('javascript:void(m=window.open("","m","height=30,width=150"));m.focus();m.document.write(\'<form><select onchange="opener.eval(this[this.selectedIndex].value)"><option value=""><option value="self.resizeTo(640,480)">640x480<option value="self.resizeTo(800,600)">800x600<option value="self.resizeTo(1024,768)">1024x768</select></form>\')','Resize')
</script>

This is for running selected code. You select the code then open the bookmark. (I used it testing this post.)

<script>
javascript:window.external.AddFavorite('javascript:void(window.open("javascript:document.write(opener.document.selection.createRange().text);document.close()"))','Run Code Selected')
</script>

Turn borders on to see table layout.

<script>
javascript:window.external.AddFavorite('javascript:void(t=document.getElementsByTagName("table"));for(i=0;i<t.length;i++){void(t[i].border="1")}','Borders On')
</script>


I use them regularly hope they're usefull to you.

glenmac
02-17-2004, 05:28 PM
The code I've posted, when copied and pasted gives errors when run as an htm file. It happened when I copied and pasted it here. To fix it you have to take the spaces out between "java " and "script". Don't know why it has the added spaces but it does. So the procedure is to copy and paste the code into notepad , remove the spaces, save the fie as an htm document and then open it. It will give you a warning but don't worry it's safe code then will create a bookmark that will do as expected.

glenngv
02-18-2004, 06:01 AM
http://www.codingforums.com/showthread.php?s=&threadid=2090#post117971

glenmac
02-18-2004, 07:10 AM
I should've read that forum first, sorry :o . It won't happen again

shlagish
02-20-2004, 12:51 AM
How do you use this?

glenmac
02-20-2004, 06:24 PM
Copy the code into notepad save as a HTML file then open it. After a warning it will ask you if you want to save it as a bookmark , say yes then when you are viewing a webpage that you want to resize, or see borders open the favorites menu and choose the appropriate book mark it will open a little window that will give you a choice of screen resolution or put borders on tables on the page being veiwed. If you want to run selected code you first select the code then choose the run code bookmark. I use them all the time to test pages I'm writing or to see how tables have been set up or to run code on a webpage for testing purposes.

glenmac
02-20-2004, 06:31 PM
Copy the code into notepad save as a HTML file then open it. After a warning it will ask you if you want to save it as a bookmark , say yes then when you are viewing a webpage that you want to resize, or see borders open the favorites menu and choose the appropriate book mark it will open a little window that will give you a choice of screen resolution or put borders on tables on the page being veiwed. If you want to run selected code you first select the code then choose the run code bookmark. I use them all the time to test pages I'm writing or to see how tables have been set up or to run code on a webpage for testing purposes.

glenmac
02-20-2004, 06:33 PM
Sorry for the double post . I hit the back button. That too won't happen again I'm learning!!!!

shlagish
02-21-2004, 10:35 PM
Thanks.

For the double post, I think you can erase one of them. Use the edit button.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum