* admin_teGa Help me, javascript not work

<! DOCTYPE html>
<script language="javascript">
function Login(){

var username=document.login.username.value;
var password=document.login.password.value;
if (username=="payung hitam" && password=="trii"){
alert("<img src='img/07.gif' width='' height='' style=''><br/>Yeah!! Jawaban Kamu Benar!");
alert("<img src='img/03.gif' width='' height='' style=''/><br/>Ohh!! Jawaban Kamu Salah!");
<form name="login">
<input type="hidden" name="password" value="trii">
<div class="jwb">
<input name="username" type="text" style="background:#fff;padding:10px;color:#008B8B;border:2px solid #fff;border-radius:5px;font-size:20px"/>
<input style="background:#008B8B;padding:10px;color:#fff;border:2px solid #008B8B;border-radius:5px;font-size:20px" onclick="Login()" type="button" value="cek" />
2015-11-02 22:09 · (0)
* Graham * admin_teGa Actually it is working fine
you just cannot "alert" html like that alert just outputs text
add a div with a id as a target and use innerHTML
<div id="abc"></div>
and then instead of alert use
document.getElementById("abc").innerHTML="<img src='img/07.gif' width='' height='' style=''><br/>Yeah!! Jawaban Kamu Benar!";
document.getElementById("abc").innerHTML="<img src='img/03.gif' width='' height='' style=''/><br/>Ohh!! Jawaban Kamu Salah!";
or just use text only in the alert
2015-11-02 23:21 (edited 2015-11-02 23:31 by Graham ) · (0)
* admin_teGa * Graham The code was written in part? Could write his code placement
2015-11-03 05:27 · (0)
* admin_teGa * Graham Mr. Please reply
2015-11-03 10:08 · (0)
* Lordeagle * admin_teGa Just as Graham has said u cant output html using window alert only the source code will be displayed so use the suggested method above, you can also use<span style="background:inherit;color:#f00" id="abc"></span> u duplicate itc an use it with the two input field and change their id . Using a function can help as well function info(msg,id){document.getElementById(id).innerHTML=msg;} u can add it in the if statement thus info("wrong password","password");weong password is the message and id is the targeted id.
2015-11-04 05:10 (edited 2015-11-04 05:13 by Lordeagle ) · (0)
* admin_teGa * Lordeagle Please full codes
2015-11-04 05:52 · (0)
* Lordeagle * admin_teGa Dont get you.
2015-11-04 08:51 · (0)
* Rare Html codes are not supported in window alert, and use ' (apostrophy) in javascript dont use " (quotation mark)
2016-02-24 04:00 · (0)
* AGKLOADED * Lordeagle Where should i put it
2018-09-18 14:52 · (0)

Online: Guests: 1