-

2011年8月4日星期四

More questions about coding?

-A very basic form of what I'm doing:

===

<html>

<head>

<script type="text/javascript">

<!--

function onlyAllowNumbers(evt){

var charCode = (evt.which) ? evt.which : event.keyCode

if(charCode === 13){ adoptIt(); }

if(charCode > 31 && (charCode < 48 || charCode > 57)){ return false; }else{ return true; }

}

function adoptIt(){

var min = 5; var max = 2700; var link = "http://www.dragonopia.com/levelup?id="

var dragonNum = parseInt(document.getElementById("dragon鈥?br>
if(!isNaN(dragonNum)){

if(dragonNum<min){ alert("Dragon 5 is the lowest!"); }

else if(dragonNum>max){ alert("Sorry, that Dragon has yet to be born!"); }

else{ window.location = link+dragonNum; }

}

}

//-->

</script>

</head>

<body>

<div id="dragonLinks">

Dragon: <input type="text" id="dragonNumber" value="5" size="5" onkeypress="return onlyAllowNumbers(event)">

<input type="button" value="Click this dragon!" OnClick='adoptIt()'>

</div>

</body>

</html>

===

I want to change two things on this. 1) I want to be able to put '100-150' or '5-200' (or whatever) and have it open all tabs between those numbers, inclusive. 2) I would like to change it so that when the button is pressed, that the page is opened in a new tab, not the same page.

===

This may be a bit confusing, so basically, what the coding up there is- is a script allowing one to input a number and take you to a page with that adoptable who's birth URL number it matches, because I'm lazy and I don't want to spend hours clicking 2700+ adoptables when I can just use a program to help me instead~

And if you only 'answer' this question to call it cheating, then you're just as bad as me, because we all know you're 1) just trying to troll and 2) trying to earn points.

没有评论:

发表评论