My login page javascript button not working - javascript

<center>
<table>
<form method="post" name="login" enctype="application/x-www-form-urlencoded">
<tr>
<td colspan="2" align="center">
<font face="arial" size="5">AreĆ” do Cliente</font>
</td>
</tr>
<tr>
<td>
E-mail:
</td>
<td>
<input type="text" name="credential_0" value="" size="30" maxlength="128" class="formfield">
</td>
</tr>
<tr>
<td>
Senha:
</td>
<td>
<input type="password" naem="credential_1" size="20" maxlength="50" class="formfield">
</td>
</tr>
<tr>
<tr>
<input type="submit" name="Log In" value="Check Mail" onclick="javascript:login.action='https://thewebsite.com/mail/index.bml?s=1';javascript:login.destination.value = '/mailadmin/index.bml?check=1';">
</td>
<td>
<input type="submit" name="Log In" value="Manage Mail" onclick="javascript:login.action='https://thewebsite.com/mailLogin';javascript:login.destination.value = '/mailadmin/index.bml?manage=1';">
</td>
</tr>
<input type="hidden" name="destination">
</form>
</table>
</center>
I am not an expecialist but i don't know much of javascript, also i need a little help on the full code. Check for me if it's all ok!
But my main question is how i make this button open in a new window/tab or set url parent?
https://thewebsite.com/mail/index.bml?s=1';javascript:login.destination.value
= '/mailadmin/index.bml?check=1';" >

<a target="_blank" href="https://www.wikipedia.org/">Wikipedia (opens in a new window)</a>
You can open page in new tab or page by using anchor tag very easily. Like,
The home page will open in another tab.
Read more:
https://html.com/attributes/a-target/#ixzz5Sh13WUpK
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

Related

Is there a way I can make a form button link to a different page after certain number of clicks?

I am creating a landing page with a form. I want to set up where every 10th person who signed up links to a "special" page where they receive a prize. For example: first 9 people will redirect to thankyou.html page where the 10th person will link to prize.html page. Is this possible? Thank you in advance.
<form method="post" enctype="multipart/form-data" action="http://form.relevanttools.com/rt-cgi-bin/satellite">
<input type="hidden" name="code" value="12531"> <input type="hidden" name="db" value="project"> <input type="hidden" name="source" value="Prize"> <input type="hidden" name="optin" value=""> <input type="hidden" name="type" value="signup"> <input type="hidden" name="user_email_msg" value=""> <input type="hidden" name="admin_email_addr" value=""> <input type="hidden" name="redir" value="http://www.link.com/thankyou.html">
<table border="0">
<tr>
<td> </td>
<td>First Name*</td>
<td> </td>
<td> <input type="text" id="first_name" name="first_name*" size="20" value=""> </td>
</tr>
<tr>
<td> </td>
<td>Last Name*</td>
<td> </td>
<td> <input type="text" id="last_name" name="last_name*" size="20" value=""> </td>
</tr>
<tr>
<td> </td>
<td>Email*</td>
<td> </td>
<td> <input type="text" id="email" name="email*" size="20" value=""> </td>
</tr>
<tr>
<td> </td>
<td>Age*</td>
<td> </td>
<td> <input type="text" id="age" name="age*" size="20" value=""> </td>
</tr>
<tr>
<td> </td>
<td>Gender</td>
<td> </td>
<td>
<div class="align-left"> <input type="radio" name="gender" value="Male">Male<br> <input type="radio" name="gender" value="Female">Female<br> </div>
</td>
</tr>
<tr>
<td> </td>
<td>Zip</td>
<td> </td>
<td> <input type="text" id="zip" name="zip" size="20" value=""> </td>
</tr>
<tr>
<td> </td>
<td>Private Policy*</td>
<td> </td>
<td> <input type="checkbox" id="private_policy" name="private_policy" value="x"> </td>
</tr>
<tr>
<td> </td>
<td>Email Subscription</td>
<td> </td>
<td> <input type="checkbox" id="email_opt_in" name="email_opt_in" value="x"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><input type="submit" value = "Submit" ></td>
</tr>
</table>
</form>
You could give the button a 10% probability of redirecting to the prize page - but that's the best without a server.
Javascript is client side. Meaning it has no way of knowing how other people have acted. The only way to know that is storing every click in a database and counting that.

how can i bypass this form? Is there a way to login into any id if i don't know the password?

i have a form which i want to bypass. Is there a way to bypass this using javascript or any other technique? Also how can i make out that this form is sql vulnerable?
<form method="post" action="/auth/login/">
<input type="hidden" name="next" value="">
<input type="hidden" name="csrfmiddlewaretoken" value="Tpy2uWI03EnzWIN3COSUvuVh5GrcUICo">
<fieldset class="fieldset_main">
<table>
<tbody><tr>
<th class="requiredfield">
<label for="id_username">Username:</label></th>
<td colspan="2"><input id="id_username" maxlength="254" name="username" type="text">
</td>
</tr>
<tr>
<th class="requiredfield">
<label for="id_password">Password:</label></th>
<td colspan="2"><input id="id_password" name="password" type="password">
</td>
</tr>
<tr>
<th>
<label for="id_rememberme">Keep me logged in:</label></th>
<td colspan="2"><input id="id_rememberme" name="rememberme" type="checkbox">
</td>
</tr>
</tbody></table>
</fieldset>
<input type="submit" value="login" class="button">
</form>
OK. Here is the serious answer. it's not the FORM that needs to be secure, it's the back-end code that handles the data. If you enter non-sanitized content into queries, or don't properly handle/process/use the entered data, that's where the vector will be. The form is purely aesthetic

How to dynamically adjust html table based on browser window size

I want my site to display differently based on the size of the web browser. Based on the questions/answers from other users, I got this to work with JavaScript onload. But I can't get it to work dynamically -- that is to say, in real-time, as users are adjusting the window. They have to refresh to get the format of the webpage to change.
Here is my current code:
<table class="index_table" border="0">
<tr>
<!--BELOW IS JAVASCRIPT FOR ADJUSTING HTML BASED ON WINDOW SIZE -->
<script>
if (window.innerWidth > 900){
document.write('<td rowspan="3" class="index_article"></td>');
}
</script>
<!-- END OF JAVASCRIPT -->
<td class="index_article_light">
<h2 class="index_instructions_subheader">INSERT HEADER HERE</h2>
<p class="index_instructions">INSERT PARAGRAPH HERE.</p>
<p class="index_instructions">INSERT PARAGRAPH HERE. </p>
<br />
<form action="signup.html" style="vertical-align:top;">
<table border="0" style="margin-left:auto;margin-right:auto;width:400px;">
<tr>
<td>
<input type="text" name="search" class="firstname" value=" First name">
</td>
<td>
<input type="text" name="search" class="lastname" value=" Last name">
</td>
</tr>
<tr>
<td colspan="2">
<input type="text" name="search" class="email" value=" Email">
</td>
</tr>
<tr>
<td colspan="2">
<div style="color:#979797;">Password: <br /><input type="password" name="password" class="password" value="Password"></div>
</td>
</tr>
<tr>
<td>
<div style="color:#979797;">Verify password: <input type="password" name="verify_passwords" class="password" value="Password"></div>
</td>
</tr>
<tr>
<td colspan="2">
<select>
<option value="kent">INSERT LIST HERE</option>
</select>
</tr>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="signup!" style="float:right;" id="result_submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
<!--BELOW IS JAVASCRIPT FOR ADJUSTING HTML BASED ON WINDOW SIZE -->
<script>
if (window.innerWidth < 900){
document.write('<tr><td class="index_article" style="height:200px;"></td></tr>');
}
</script>
<!-- END OF JAVASCRIPT -->
Note: I know I shouldn't be used tables, I should be using divs. But that's another issue... I started building this website before I knew that. I also know it's pretty sloppy. So just bear with me. I'm trying to just go with it until I have time to fix it up.
You shouldn't use JavaScript to make responsive web design. Use CSS instead, with media querys. So you write your HTML:
<table class="index_table" border="0">
<tr>
<!--This only will display on screen-width>900-->
<td id="big_device_index" rowspan="3" class="index_article"></td>
<td class="index_article_light">
<h2 class="index_instructions_subheader">INSERT HEADER HERE</h2>
<p class="index_instructions">INSERT PARAGRAPH HERE.</p>
<p class="index_instructions">INSERT PARAGRAPH HERE. </p>
<br />
<form action="signup.html" style="vertical-align:top;">
<table border="0" style="margin-left:auto;margin-right:auto;width:400px;">
<tr>
<td>
<input type="text" name="search" class="firstname" value=" First name">
</td>
<td>
<input type="text" name="search" class="lastname" value=" Last name">
</td>
</tr>
<tr>
<td colspan="2">
<input type="text" name="search" class="email" value=" Email">
</td>
</tr>
<tr>
<td colspan="2">
<div style="color:#979797;">Password: <br /><input type="password" name="password" class="password" value="Password"></div>
</td>
</tr>
<tr>
<td>
<div style="color:#979797;">Verify password: <input type="password" name="verify_passwords" class="password" value="Password"></div>
</td>
</tr>
<tr>
<td colspan="2">
<select>
<option value="kent">INSERT LIST HERE</option>
</select>
</tr>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="signup!" style="float:right;" id="result_submit">
</td>
</tr>
</table>
</form>
</td>
</tr>
<!--This only will display on screen-width<900-->
<tr id="small_device_index"><td class="index_article" style="height:200px;"></td></tr>
Use the following CSS:
#media all and (max-width: 899px) {
#big_device_index {
display: none;
}
#media all and (min-width: 900px) {
#small_device_index {
display: none;
}
You can find out more about media queries here
}
Add this outside of if (window.innerWidth > 900){.....
$(window).resize(function(){
if (window.innerWidth > 900){
$('.index_article').remove();
$('.index_table).find('tr:first').append('<td rowspan="3" class="index_article"></td>');
}
}
hope this will help you, make sure to include fisrt jquery.min.js

all the link in my php form direct to the form action

This is my following codes..
<form class="form-horizontal" id="tambah_gps" name="tambah_gps" method="POST" action="../controller/add_gps.php">
<table>
<tr style="height:40px">
<td>Nama User</td>
<td style="width:20px"> : </td>
<td><input class="form-control" type="text" name="nama_user" placeholder=" User Name" style="width:300px" readonly></td>
<td>&nbsp&nbspChoose User</button></td>
</tr>
<tr style="height:40px">
<td>Vehicle ID</td>
<td style="width:20px"> : </td>
<td colspan="2"><input class="form-control" type="text" name="no_polisi" placeholder=" Nomor Polisi Kendaraan"></td>
</tr>
<tr style="height:40px">
<td>Car brand</td>
<td style="width:20px"> : </td>
<td colspan="2"><input class="form-control" type="text" name="merk_mobil" placeholder=" Merk Mobil"></td>
</tr>
<tr style="height:40px">
<td>Color</td>
<td style="width:20px"> : </td>
<td colspan="2"><input class="form-control" type="text" name="warna" placeholder=" Warna"></td>
</tr>
<tr style="height:40px">
<td>GPS Number</td>
<td style="width:20px"> : </td>
<td colspan="2"><input class="form-control" type="text" name="no_telp_gps" placeholder=" nomor telepon GPS"><td>
</tr>
<tr style="height:40px">
<td>Time Zone/td>
<td style="width:20px"> : </td>
<td colspan="2"><input class="form-control" type="text" name="zona_waktu" value="GMT (Default)" placeholder=" Zona Waktu" readonly></td>
</tr>
</table>
<div class="modal-footer">
<button class="btn btn-default" data-dismiss="modal">Cancel</button>
<input type="submit" name="sumbit" value="Save" class="btn btn-primary">
</div>
<form>
The form I made has 3 buttons : 1 Button Save, 1 Button Cancel, and 1 button to choose User Name.. if the button to choose user name clicked, it will open new window that containing user list. the button works pretty well. but whenever it clicked the page always directed to the form action (just like when you click the save button). Can anyone tell me whats wrong with my code? Thank you...
First of all you use your <button> inside of <a> where latter has javascript:void(0) as href. If href is not needed then there no point to put <a> around <button>.
Second &nbps entity MUST end with ;
Third javascript in onclick must be enclosed by " . Single quotes should be used within javascript statement.
And last: you must tell <button> to be exactly what you want it to be: just button! by using type='button'
Therefore the line for your "Choose User" button looks as follows:
<td> <button type="button" class="btn btn-primary" onClick="window.open('pilih_user.php','Ratting','width=1000,height=400,left=200');">Choose User</button></a></td>

javascript .serialize() function is not working

HTML CODE
<form id="createCFrom">
<table class="ui-widget">
<tr>
<td>Event
</td>
<td>
<input type="text" id="CreateName" name="Event" />
</td>
</tr>
<tr>
<td>Date
</td>
<td>
<input type="text" id="CreateDate" name="Date" />
</td>
</tr>
<tr>
<td>Guest
</td>
<td>
<input type="text" id="CreateGuestName" name="Guest" />
</td>
</tr>
<tr>
<td colspan="2">
<button onclick="addCeremony();" class="right" id="saveCeremony">Save</button>
</td>
</tr>
</table>
</form>
JS Code
function addCeremony() {
alert($("#createCForm").serialize());
}
Your id is createCFrom
<form id="createCFrom">
but your script refers to createCForm
function addCeremony() {
alert($("#createCForm").serialize());
}
hi have change <button> to <input> type and it is working please try this
<input type='button' onclick="addCeremony();" class="right" id="saveCeremony" value='Save'>
fiddle
You have a typo:
alert($("#createCForm").serialize());
Should be:
alert($("#createCFrom").serialize());
(Or perhaps the id of the form is where the typo is - up to you to decide, but obviously what I'm saying is the id of the form has to match the id you use in your JS.)
Correct that problem and it works: http://jsfiddle.net/K5FVg/

Categories

Resources